//
//  NWItemsModle.m
//  World
//
//  Created by lanou on 15/10/24.
//  Copyright © 2015年 小虫. All rights reserved.
//

#import "NWItemsModle.h"
#import "NWCategoriesModle.h"
@implementation NWItemsModle

- (instancetype)init
{
    self = [super init];
    if (self) {
        _author = [[NWAuthorInfo alloc]init];
        _categories = [NSMutableArray arrayWithCapacity:0];
        _guide_image = [[NWGuide_imageInfo alloc]init];
    }
    return self;
}

- (void)setValue:(id)value forKey:(NSString *)key
{
    if ([key isEqualToString:@"author"])
    {
        [self.author setValuesForKeysWithDictionary:value];
    }else if([key isEqualToString:@"categories"])
    {
        NSDictionary *dict = value[0];
        NWCategoriesModle *modle = [[NWCategoriesModle alloc]init];
        [modle setValuesForKeysWithDictionary:dict];
        [self.categories addObject:modle];
    }else if([key isEqualToString:@"guide_image"])
    {
        [self.guide_image setValuesForKeysWithDictionary:value];
    }else{
        [super setValue:value forKey:key];
    }
   
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}
@end
